package com.module.pubpage.ui.index

import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.common.app.core.RouterHub
import com.common.base.app.fragment.BaseVMFragment
import com.common.base.utils.StatusBarUtils
import com.common.base.utils.StatusBarUtils.setStatusBarHeight
import com.module.pubpage.databinding.PubpageFragmentIndexBinding

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：17/2/2023
 *
 * 描述：公共页首页
 *
 * 修订历史：
 *
 */
@Route(path = RouterHub.ROUTER_PUBPAGE_INDEX_FRAGMENT)
class IndexFragment : BaseVMFragment<PubpageFragmentIndexBinding, IndexViewModel>(),
    View.OnClickListener {

    override fun getViewModel() = IndexViewModel::class.java

    override fun getViewBinding() = PubpageFragmentIndexBinding.inflate(layoutInflater)

    override fun getSmartRefreshLayout() = mViewBinding.smartRefreshLayout

    override fun getPlaceholderView() = mViewBinding.mPlaceholder

    override fun initViews() {
        super.initViews()
        showLoading()
        setStatusBarHeight(mViewBinding.statusView)
    }

    override fun initEvents() {
        super.initEvents()
        setErrorRetryListener { lazyInitData() }
    }


    override fun onSupportVisible() {
        super.onSupportVisible()
        StatusBarUtils.setStatusBarForegroundColor(requireActivity(), true)
    }

    override fun onSupportInvisible() {
        super.onSupportInvisible()
    }


    override fun lazyInitData() {
    }

    override fun onClick(v: View?) {
        v?.isSelected = true
        when (v) {
        }
    }


    //下拉刷新
    override fun onRefreshListener() {
        super.onRefreshListener()
        lazyInitData()
    }
}